/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author m.pinedo
 */

import javax.swing.*;
import javax.swing.table.*;

public class Tabla extends JFrame {

    public Tabla() {
	super("Una Tabla");

	TableModel tm = new AbstractTableModel() {
		String[][] datos = {{"Pepe",   "2.9"},
	 			    {"Luis",   "7.4"},
				    {"Pepe",   "2.9"},
                                    {"Pepe",   "2.9"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"}, {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"}, {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"}, {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"},
				    {"Andres", "5.0"},
	 			    {"Luis",   "7.4"}};
		String[] titulos = {"Nombre", "Nota"};

		public int getRowCount() {
		    return datos.length;
		}
		public int getColumnCount() {
		    return titulos.length;
		}
		public Object getValueAt(int r, int c) {
		    return datos[r][c];
		}
		public String getColumnName(int c) {
		    return titulos[c];
		}
	    };

	JTable jt = new JTable(tm);

	JScrollPane jsp = new JScrollPane(jt);
	getContentPane().add(jsp);

	pack();
	setVisible(true);
    }

    public static void main(String args[]) {
	Tabla t = new Tabla();
    }
}
